
package AccionesSemanticas;

public class AccErrors implements AccSemantica {

    private int[] lineNumber;
    private StringBuilder tokenChars;
    private int[] lastState;
    
    public AccErrors(int[] lineNumber, StringBuilder tokenChars, int[] lastState){
        this.lineNumber = lineNumber;
        this.tokenChars = tokenChars;
        this.lastState = lastState;
    }
    
    public String doAction() {
        lastState[0] = 0;
        String err;
        String c = tokenChars.toString().substring(0,1);
        if(c.equals(":"))
            err="Linea " + lineNumber[0] +": Error de sintaxis de asignacion";
        else if(c.equals("\""))
            err="Linea " + lineNumber[0] +": Error de sintaxis de cadena";
        else if(c.equals("*"))
            err="Linea " + lineNumber[0] +": Error de sintaxis de comentario multilinea";
        else if (((c.charAt(0)>=48) && (c.charAt(0)<=57)) || c.equals("."))
            err="Linea " +  + lineNumber[0] +": Error de sintaxis de double";
        else err="Linea " +  + lineNumber[0] +": Error de sintaxis";
        tokenChars.delete(0, tokenChars.length());
        return err;
        
    }
   
}
